import { _decorator, CCInteger, Component, Node } from "cc";
const { ccclass, property } = _decorator;

export enum RewardType {
  REWARD_TWOSHOOT = 1,
  REWARD_BOMB = 2,
}

@ccclass("Reward")
export class Reward extends Component {
  @property
  public speed: number = 100;


  @property
  public rewardType: RewardType = RewardType.REWARD_TWOSHOOT;

  start() {}

  update(deltaTime: number) {
    this.node.setPosition(
      this.node.position.x,
      this.node.position.y - this.speed * deltaTime,
      this.node.position.z
    );

    // 超出屏幕边界销毁
    if (this.node.position.y < -580) {
      this.node.destroy();
    }
  }
}
